<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateSystemProjectModule extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('system_project_module', function (Blueprint $table) {
            $table->id();

            $table->unsignedInteger("projectId")->default(0)->comment("项目Id");
            $table->string("enName")->default("")->comment("模块英文名称");
            $table->string("cnName")->default("")->comment("模块中文名称");
            $table->string("moduleCode")->default("")->comment("模块标识");

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->unsignedInteger('isDeleted')->default(0)->comment('是否删除 0 - 正常 1 - 已删除');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '项目模块记录';

            $table->unique(["projectId", "enName"], "idx_projectId_enName");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('system_project_module');
    }
}
